home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / laptop.gl.p < prev    next >
Text File  |  2003-01-02  |  12KB  |  360 lines

  1. {
  2.  
  3.   ScriptID = script {
  4.       @setup {
  5.       ResByName("dispatch.gl");
  6.         ResByName("map.gl");
  7.         ResByName("country_map.gl");
  8.       ResByName("expense.gl");
  9.       ResByName("photo_album.gl");
  10.       ResByName("travel_log.gl");
  11.       ResByName("help.gl");
  12.       ResByName("eat.tab");
  13.       ResByName("fuel.tab");
  14.       ResByName("load.tab");
  15.       ResByName("maintenance.tab");        
  16.       ResByName("postcard.tab");
  17.       ResByName("system.tab");
  18.       ResByName("timezone.tab");
  19.       ResByName("sleep.tab");
  20.       ResByName("dash.gl");
  21.       ResByName("cell_phone.gl");
  22.       ResByName("switch_player.gl");
  23.       }
  24.       @show {
  25.         ResParseEvent(ResByName("laptop.gl/switch_player_layer"),"@update");
  26.       }
  27.  
  28.   };
  29.  
  30.   ChildID = {
  31.     GuiLaptopController("laptop_controller") {
  32.       ScriptID = script {
  33.         @animate {
  34.           resid sound;
  35.           resid panel_to_display;
  36.           resid panel_being_displayed;
  37.           int hide_all;
  38.           sound = ResByName("sound/button_click.wav");
  39.  
  40.           ResPropAlias(SELF, "panel_to_display", "panel_to_display");
  41.           ResPropAlias(SELF, "panel_being_displayed", "panel_being_displayed");
  42.           ResPropAlias(SELF, "hide_all", "hide_all");
  43.           
  44.           if (! ResValid(panel_being_displayed) ) {
  45.             /* Log(LOG_DEBUG,"setting tab to dispatch\n"); */
  46.             panel_being_displayed = RES_INVALID;
  47.             panel_to_display = ResByName("dispatch.gl");
  48.             ResPRopSetResID(GuiSiblingByName("dispatch"),"RadioGroupSelectedID",GuiSiblingByName("dispatch"));
  49.           }
  50.  
  51.           
  52.           if (panel_to_display != panel_being_displayed) {
  53.             AudioPlay( sound );
  54.             if (ResValid(panel_being_displayed)) {
  55.               ResPropSetInt(panel_being_displayed, "Hidden", TRUE);
  56.             }
  57.             ResPropSetInt(panel_to_display, "Hidden", FALSE);
  58.             panel_being_displayed = panel_to_display;
  59.           }
  60.  
  61.          
  62.           /* Um, this is done every frame? probably shouldn't be */
  63.          
  64.           if (hide_all == 1) {
  65.             ResPropSetInt(panel_being_displayed, "Hidden", TRUE);
  66.             ResPropSetInt(ResByName("laptop.gl"), "Hidden", TRUE);
  67.             ResPropSetInt(ResByName("dash.gl"), "Hidden", FALSE);
  68.             ResPropSetInt(ResByName("eat.tab"), "Hidden", FALSE);
  69.             ResPropSetInt(ResByName("fuel.tab"), "Hidden", FALSE);
  70.             ResPropSetInt(ResByName("load.tab"), "Hidden", FALSE);
  71.             ResPropSetInt(ResByName("maintenance.tab"), "Hidden", FALSE);          
  72.             ResPropSetInt(ResByName("postcard.tab"), "Hidden", FALSE);
  73.             ResPropSetInt(ResByName("system.tab"), "Hidden", FALSE);
  74.             ResPropSetInt(ResByName("timezone.tab"), "Hidden", FALSE);
  75.             ResPropSetInt(ResByName("sleep.tab"), "Hidden", FALSE);                
  76.           } else {
  77.             ResPropSetInt(panel_being_displayed, "Hidden", FALSE);
  78.             ResPropSetInt(ResByName("laptop.gl"), "Hidden", FALSE);
  79.             ResPropSetInt(ResByName("dash.gl"), "Hidden", TRUE);
  80.             ResPropSetInt(ResByName("eat.tab"), "Hidden", TRUE);
  81.             ResPropSetInt(ResByName("fuel.tab"), "Hidden", TRUE);
  82.             ResPropSetInt(ResByName("load.tab"), "Hidden", TRUE);
  83.             ResPropSetInt(ResByName("maintenance.tab"), "Hidden", TRUE);          
  84.             ResPropSetInt(ResByName("postcard.tab"), "Hidden", TRUE);
  85.             ResPropSetInt(ResByName("system.tab"), "Hidden", TRUE);
  86.             ResPropSetInt(ResByName("timezone.tab"), "Hidden", TRUE);
  87.             ResPropSetInt(ResByName("sleep.tab"), "Hidden", TRUE);                    
  88.           }
  89.  
  90.         }
  91.       }
  92.     },
  93.  
  94.     GuiButtonGroup("map") {
  95.       X = 25;
  96.       Y = 14;
  97.       AutoSize = HEIGHT;
  98.       AutoSize = WIDTH;
  99.       RadioGroupID = 1;
  100.       ScriptID = Script {
  101.         @activate { 
  102.           ResPropSetResID(ResByName("laptop.gl/laptop_controller"),"panel_to_display", ResByName("map.gl"));
  103.         }
  104.       };
  105.       ChildID = {
  106.         GuiButton("map_off") {
  107.           UpID = "gui/laptop/laptop_tab/map_off.pcx";
  108.         },
  109.         GuiButton("map_on") {
  110.           UpID = "gui/laptop/laptop_tab/map_on.pcx";
  111.         }
  112.       };
  113.     },
  114.     
  115.     GuiButtonGroup("country_map") {
  116.       X = 75;
  117.       Y = 14;
  118.       AutoSize = HEIGHT;
  119.       AutoSize = WIDTH;
  120.       RadioGroupID = 1;
  121.       ScriptID = Script {
  122.         @activate { 
  123.           ResPropSetResID(ResByName("laptop.gl/laptop_controller"),"panel_to_display", ResByName("country_map.gl"));
  124.         }
  125.       };      
  126.       ChildID = {
  127.         GuiButton("map_off") {
  128.           UpID = "gui/laptop/laptop_tab/country_map_off.pcx";
  129.           
  130.         },
  131.         GuiButton("map_on") {
  132.           UpID = "gui/laptop/laptop_tab/country_map_on.pcx";
  133.         }
  134.       };
  135.     },
  136.     
  137.     GuiButtonGroup("dispatch") {
  138.       X = 125;
  139.       Y = 14;
  140.       AutoSize = HEIGHT;
  141.       AutoSize = WIDTH;
  142.       RadioGroupID = 1;
  143.       ScriptID = Script {
  144.         @activate {
  145.         /* Log(LOG_DEBUG,"dispatch tab set\n"); */
  146.           
  147.           ResPropSetResID(ResByName("laptop.gl/laptop_controller"),"panel_to_display", ResByName("dispatch.gl"));
  148.  
  149.         }
  150.       };      
  151.       ChildID = {
  152.         GuiButton("dispatch_off") {
  153.           UpID = "gui/laptop/laptop_tab/dispatch_off.pcx";
  154.           
  155.         },
  156.         GuiButton("dispatch_on") {
  157.           UpID = "gui/laptop/laptop_tab/dispatch_on.pcx";
  158.         }
  159.       };
  160.     },
  161.     GuiButtonGroup("expenses") {
  162.       X = 175;
  163.       Y = 14;
  164.       AutoSize = HEIGHT;
  165.       AutoSize = WIDTH;
  166.       RadioGroupID = 1;
  167.       ScriptID = Script {
  168.         @activate { 
  169.           ResPropSetResID(ResByName("laptop.gl/laptop_controller"),"panel_to_display", ResByName("expense.gl"));
  170.         }
  171.       };      
  172.       ChildID = {
  173.         GuiButton("expenses_off") {
  174.           UpID = "gui/laptop/laptop_tab/expenses_off.pcx";
  175.           
  176.         },
  177.         GuiButton("expenses_on") {
  178.           UpID = "gui/laptop/laptop_tab/expenses_on.pcx";
  179.         }
  180.       };
  181.     },
  182.     GuiButtonGroup("photos") {
  183.       X = 225;
  184.       Y = 14;
  185.       AutoSize = HEIGHT;
  186.       AutoSize = WIDTH;
  187.       RadioGroupID = 1;
  188.       ScriptID = Script {
  189.         @activate { 
  190.           ResPropSetResID(ResByName("laptop.gl/laptop_controller"),"panel_to_display", ResByName("photo_album.gl"));
  191.         }
  192.       };      
  193.       ChildID = {
  194.         GuiButton("photos_off") {
  195.           UpID = "gui/laptop/laptop_tab/photo_album_off.pcx";
  196.           
  197.         },
  198.         GuiButton("photos_on") {
  199.           UpID = "gui/laptop/laptop_tab/photo_album_on.pcx";
  200.         }
  201.       };
  202.     },
  203.      GuiButtonGroup("log") {
  204.       X = 275;
  205.       Y = 14;
  206.       AutoSize = HEIGHT;
  207.       AutoSize = WIDTH;
  208.       RadioGroupID = 1;
  209.       ScriptID = Script {
  210.         @activate {
  211.           ResPropSetResID(ResByName("laptop.gl/laptop_controller"),"panel_to_display", ResByName("travel_log.gl"));
  212.         }
  213.       };      
  214.       ChildID = {
  215.         GuiButton("log_off") {
  216.           UpID = "gui/laptop/laptop_tab/travel_log_off.pcx";
  217.           
  218.         },
  219.         GuiButton("log_on") {
  220.           UpID = "gui/laptop/laptop_tab/travel_log_on.pcx";
  221.         }
  222.       };
  223.     },
  224.     GuiButtonGroup("help") {
  225.       X = 325;
  226.       Y = 14;
  227.       AutoSize = HEIGHT;
  228.       AutoSize = WIDTH;
  229.       RadioGroupID = 1;
  230.       ScriptID = Script {
  231.         @activate { 
  232.           ResPropSetResID(ResByName("laptop.gl/laptop_controller"),"panel_to_display", ResByName("help.gl"));
  233.         }
  234.       };      
  235.       ChildID = {
  236.         GuiButton("help_off") {
  237.           UpID = "gui/laptop/laptop_tab/help_off.pcx";
  238.           
  239.         },
  240.         GuiButton("help_on") {
  241.           UpID = "gui/laptop/laptop_tab/help_on.pcx";
  242.         }
  243.       };
  244.     },
  245.  
  246.     GuiButton("dash") {
  247.       X = 560;
  248.       Y = 14;
  249.       AutoSize = HEIGHT;
  250.       AutoSize = WIDTH;
  251.       StyleID = "gui/bs/dash.gbs";
  252.       ScriptID = Script {
  253.         @activate {
  254.           resid mc;
  255.              mc = ResByName("laptop.gl/laptop_controller");
  256.           ResPropSetInt(mc,"hide_all", 1);
  257.           ResPropSetInt(ResByName("dash.gl"),"Hidden",FALSE);
  258.           release("laptop");
  259.           release("laptop_photo");
  260.           release("laptop_new_city");
  261.         }
  262.       };    
  263.     },
  264.     GuiLayer("switch_player_layer") {
  265.       X = 490;
  266.       Y = 14;
  267.       ScriptID = Script {
  268.         @loaded {
  269.           ResParseEvent(SELF, "@update");
  270.         }
  271.         @show {
  272.           ResParseEvent(SELF, "@update");
  273.         }
  274.         @update {
  275.           resid Game;
  276.           resid Player;
  277.           resid city_data_id;
  278.           int   nav_truck_x;
  279.           int   nav_truck_y;
  280.           int   city_x;
  281.           int   city_y;
  282.           int   nav_cur_city_row_num;
  283.               
  284.           Game = ResByName("Game");
  285.  
  286.           if (ResPropGetInt(Game, "game_num_players") == 1) {
  287.             ResPropSetInt(SELF, "Hidden", TRUE);
  288.           } else {
  289.             /* get player nav truck and nav city info */
  290.             Player = ResPropGetResID(Game,"game_cur_player");
  291.             nav_truck_x = ResPropGetInt(Player, "nav_truck_x");
  292.             nav_truck_y = ResPropGetInt(Player, "nav_truck_y");
  293.             nav_cur_city_row_num = ResPropGetInt(Player, "nav_cur_city_row_num");
  294.             city_data_id = ResPropGetResID(ResByName("CSVData"), "city_id"); 
  295.             
  296.             city_x = CSVGetInt(city_data_id, "x", nav_cur_city_row_num);
  297.             city_y = CSVGetInt(city_data_id, "y", nav_cur_city_row_num);
  298.             
  299.             if (!((city_x == nav_truck_x) && (city_y == nav_truck_y))) { 
  300.               ResPropSetInt(GuiChildByName(SELF, "switch_player"), "Hidden", TRUE); 
  301.               ResPropSetInt(GuiChildByName(SELF, "switch_player_dis"), "Hidden", FALSE); 
  302.  
  303.               if (ResPropGetResID(Game, "game_cur_player") == ResPropGetResID(Game, "player_1_id")) {
  304.                 ResPropSetResID(GuiChildByName(SELF, "switch_player_dis"), "AnimationID", ResByName("gui/laptop/laptop_tab/switch2_player2_dis.pcx"));
  305.               } else {        
  306.                 ResPropSetResID(GuiChildByName(SELF, "switch_player_dis"), "AnimationID", ResByName("gui/laptop/laptop_tab/switch2_player1_dis.pcx"));  
  307.               }
  308.             } else {  
  309.               ResPropSetInt(GuiChildByName(SELF, "switch_player"), "Hidden", FALSE); 
  310.               ResPropSetInt(GuiChildByName(SELF, "switch_player_dis"), "Hidden", TRUE);   
  311.             }
  312.           }
  313.         }
  314.       };
  315.       ChildID = {
  316.         GuiAnimation("switch_player_dis") {
  317.           X = 0;
  318.           Y = 0;
  319.           Hidden = TRUE;
  320.           ScriptID = Script {
  321.             @loaded {
  322.               ResByName("gui/laptop/laptop_tab/switch2_player2_dis.pcx");
  323.               ResByName("gui/laptop/laptop_tab/switch2_player1_dis.pcx");
  324.             }
  325.           };
  326.         },
  327.         GuiButton("switch_player") {
  328.           X = 0;
  329.           Y = 0;
  330.           AutoSize = HEIGHT;
  331.           AutoSize = WIDTH;
  332.           StyleID = "gui/bs/switch2_player2.gbs";
  333.           ScriptID = Script {
  334.             @loaded {
  335.               ResByName("gui/bs/switch2_player2.gbs"); 
  336.               ResByName("gui/bs/switch2_player1.gbs"); 
  337.             }
  338.             @update {
  339.               resid Game;
  340.               Game = ResByName("Game");
  341.               if (ResPropGetResID(Game, "game_cur_player") == ResPropGetResID(Game, "player_1_id")) {
  342.                 ResPropSetResID(SELF, "StyleID", ResByName("gui/bs/switch2_player2.gbs"));
  343.               } else {        
  344.                 ResPropSetResID(SELF, "StyleID", ResByName("gui/bs/switch2_player1.gbs"));  
  345.               }           
  346.             }
  347.             @loaded {           
  348.               ResParseEvent(SELF, "@update");
  349.             }
  350.             @activate {
  351.               ResParseEvent(ResByName("common/switch_player.c4"),"@switch_player"); 
  352.               ResParseEvent(SELF, "@update");                         
  353.             }
  354.           };
  355.         }
  356.       };  /* END OF switch_player CHILDID */
  357.     }     /* END OF switch_player */
  358.   };
  359. }
  360.